package com.mazaiting.web.config;

import com.mazaiting.web.converter.String2IBaseEnumConverterFactory;
import com.mazaiting.web.converter.String2BaseVOConverterFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web 自定义数据转换器
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addFormatters(FormatterRegistry registry) {
        // 配置自定义的枚举转换器
        registry.addConverterFactory(new String2IBaseEnumConverterFactory());
        registry.addConverterFactory(new String2BaseVOConverterFactory());
    }
}